package br.perfiman.faces;

import br.perfiman.model.Address;
import br.perfiman.model.Person;
import br.perfiman.service.AbstractService;
import br.perfiman.service.PersonService;
import br.perfiman.utils.ServiceLocator;

public class PersonBean extends AbstractBean<Person> {

	public PersonBean() throws Exception {
		if(getEntity() == null){
			setEntity(new Person());
			getEntity().setAddress(new Address());
		}
		retrieveAll();
	}

	@Override
	protected AbstractService<Person> getService() throws Exception {
		if(service == null){
			service = (PersonService) ServiceLocator.getInstance().get("PersonServiceBean/remote");
		}
		return service;
	}

}
